/* ************************************************************************** */ 
/* Example of a syndication feed reader using the Project Rome API with       */ 
/* BSF4ooRexx                                                                 */ 
/* current version of Rome: rome1.0.jar            https://rome.dev.java.net/ */ 
/* You need to implement this API plus the JDOM API                           */ 
/* jdom.jar  ,   you can find this at               https://jdom.org/        ; */ 
/*                                                                            */ 
/* This class retrieves a syndfeed from the web and prints some               */ 
/* information about the feed using                                           */ 
/* "com.sun.syndication.io.SyndFeedInput" methods                             */                        
/* created by Martin Stoppacher     date:   26.12.2009                        */ 
/* license:ÊÊÊÊLGPL 3.0ÊÊÊÊÊÊÊused versions: Java 1.6, ooRexx 4.0, Bsf4ooRexx */
/*             (Lesser Gnu Public License version 3.0),                       */ 
/*             cf. <http://www.gnu.org/licenses/lgpl.html>                    */ 
/* ************************************************************************** */ 

say hello this reads a syndfeed 
--say please type in the url     /* possible input statement for the feed URL */
--pull url

--parse arg url   /*   optional input via arguments                           */

/* The url String is predefined in this example, to change the feed url       */ 
/* replace to String in this file or use one of the above methods             */ 

url= "http://rss.orf.at/fm4.xml" 
feedUrl=.bsf~new("java.net.URL", url)   /* create an instance of java.net.URL */ 
say connecting__ || feedUrl~getAuthority() 

input=.bsf~new("com.sun.syndication.io.SyndFeedInput") 
/*  creates a SyndFeedInput                                                   */ 
xmlr=.bsf~new("com.sun.syndication.io.XmlReader", feedUrl) 
/*     Figures out the charset encoding of the XML document within the stream */ 
feed= input~build(xmlr) 
/*  Builds a SyndFeedImpl from an Reader , also possible with SAX or DOM      */ 

say bb~getDefaultEncoding() 
say feed                               /* returns the feed object             */ 

::requires BSF.cls                     /* get the Java support                */